<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="theme-color" content="#0078E7"><meta name="author" content="CC康纳百川"><meta name="copyright" content="CC康纳百川"><meta name="generator" content="Hexo 5.2.0"><meta name="theme" content="hexo-theme-yun"><title>简单浏览器更新推送的实现 | CC康纳百川</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&amp;display=swap" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/star-markdown-css@0.1.21/dist/yun/yun-markdown.min.css"><script src="//at.alicdn.com/t/font_1140697_ed8vp4atwoj.js" async></script><script src="https://cdn.jsdelivr.net/npm/scrollreveal/dist/scrollreveal.min.js" defer></script><script>document.addEventListener("DOMContentLoaded", () => {
  [".post-card",".post-content img"].forEach((target)=> {
    ScrollReveal().reveal(target);
  })
});
</script><link rel="shortcut icon" type="image/svg+xml" href="/yun/yun.svg"><link rel="mask-icon" href="/yun/yun.svg" color="#0078E7"><link rel="alternate icon" href="/yun.ico"><link rel="preload" href="/yun/css/hexo-theme-yun.css" as="style"><link rel="preload" href="/yun/js/utils.js" as="script"><link rel="preload" href="/yun/js/hexo-theme-yun.js" as="script"><link rel="prefetch" href="/yun/js/sidebar.js" as="script"><link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin><link rel="stylesheet" href="/yun/css/hexo-theme-yun.css"><script id="yun-config">
    const Yun = window.Yun || {};
    window.CONFIG = {"hostname":"ccknbc.github.io","root":"/yun/","title":"云游君的小站","version":"1.2.0","mode":"time","copycode":true,"anonymous_image":"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg","say":{"api":"https://v1.hitokoto.cn","hitokoto":true},"local_search":{"path":"/yun/search.xml"},"fireworks":{"colors":["102, 167, 221","62, 131, 225","33, 78, 194"]}};
  </script><script>(function(){
  var bp = document.createElement('script');
  var curProtocol = window.location.protocol.split(':')[0];
  if (curProtocol === 'https') {
    bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else {
    bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(bp, s);
})();</script><meta name="description" content="这篇文章主要想大家介绍如何使用webpushr及其对应的插件hexo-web-push-notification来帮我们节省时间完成自动推送更新">
<meta property="og:type" content="article">
<meta property="og:title" content="简单浏览器更新推送的实现">
<meta property="og:url" content="https://ccknbc.github.io/yun/posts/4/">
<meta property="og:site_name" content="CC康纳百川">
<meta property="og:description" content="这篇文章主要想大家介绍如何使用webpushr及其对应的插件hexo-web-push-notification来帮我们节省时间完成自动推送更新">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:11:29-https/s1.ax1x.com/2020/08/18.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:51-https/s1.ax1x.com/2020/08/18.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:43-https/s1.ax1x.com/2020/08/18.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:33-https/s1.ax1x.com/2020/08/18.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:23-https/s1.ax1x.com/2020/08/18.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:00-https/s1.ax1x.com/2020/08/18.png">
<meta property="article:published_time" content="2020-08-18T12:39:36.000Z">
<meta property="article:modified_time" content="2020-08-18T12:39:36.000Z">
<meta property="article:author" content="CC康纳百川">
<meta property="article:tag" content="webpushr">
<meta property="article:tag" content="web-push">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:11:29-https/s1.ax1x.com/2020/08/18.png"><script src="/yun/js/ui/mode.js"></script></head><body><script defer src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script><script defer src="/yun/js/ui/fireworks.js"></script><canvas class="fireworks"></canvas><div class="container"><a class="sidebar-toggle hty-icon-button" id="menu-btn"><div class="hamburger hamburger--spin" type="button"><span class="hamburger-box"><span class="hamburger-inner"></span></span></div></a><div class="sidebar-toggle sidebar-overlay"></div><aside class="sidebar"><script src="/yun/js/sidebar.js"></script><ul class="sidebar-nav"><li class="sidebar-nav-item sidebar-nav-toc hty-icon-button sidebar-nav-active" data-target="post-toc-wrap" title="文章目录"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-list-ordered"></use></svg></li><li class="sidebar-nav-item sidebar-nav-overview hty-icon-button" data-target="site-overview-wrap" title="站点概览"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-passport-line"></use></svg></li></ul><div class="sidebar-panel" id="site-overview-wrap"><div class="site-info mickey-mouse"><a class="site-author-avatar" href="/yun/about/" title="CC康纳百川"><img width="96" loading="lazy" src="/yun/Yun.png" alt="CC康纳百川"><span class="site-author-status" title="永远相信美好的事情即将发生">😊</span></a><div class="site-author-name"><a href="/yun/about/">CC康纳百川</a></div><a class="site-name" href="/yun/about/site">CC康纳百川</a><sub class="site-subtitle">Hello Word</sub><div class="site-desciption">一个无趣的人</div></div><nav class="site-state"><a class="site-state-item hty-icon-button icon-home" href="/yun/" title="首页"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-home-4-line"></use></svg></span></a><div class="site-state-item"><a href="/yun/archives/" title="归档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-archive-line"></use></svg></span><span class="site-state-item-count">10</span></a></div><div class="site-state-item"><a href="/yun/categories/" title="分类"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-folder-2-line"></use></svg></span><span class="site-state-item-count">16</span></a></div><div class="site-state-item"><a href="/yun/tags/" title="标签"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="site-state-item-count">18</span></a></div><a class="site-state-item hty-icon-button" target="_blank" rel="noopener" href="https://yun.yunyoujun.cn" title="文档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-settings-line"></use></svg></span></a></nav><hr style="margin-bottom:0.5rem"><div class="links-of-author"><a class="links-of-author-item hty-icon-button" rel="noopener" href="/atom.xml" title="RSS" target="_blank" style="color:orange"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-rss-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://shang.qq.com/wpa/qunwpa?idkey=c929e704022704d8cced9ec355d44a3fa7ad34aea12cef1de03d75d3d7d5b059" title="QQ 群" target="_blank" style="color:#12B7F5"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-qq-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://github.com/YunYouJun" title="GitHub" target="_blank" style="color:#6e5494"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-github-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://weibo.com/jizhideyunyoujun" title="微博" target="_blank" style="color:#E6162D"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-weibo-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://www.douban.com/people/yunyoujun/" title="豆瓣" target="_blank" style="color:#007722"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-douban-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://music.163.com/#/user/home?id=247102977" title="网易云音乐" target="_blank" style="color:#C20C0C"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-netease-cloud-music-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://www.zhihu.com/people/yunyoujun/" title="知乎" target="_blank" style="color:#0084FF"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-zhihu-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://space.bilibili.com/1579790" title="哔哩哔哩" target="_blank" style="color:#FF8EB3"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-bilibili-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://twitter.com/YunYouJun" title="Twitter" target="_blank" style="color:#1da1f2"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-twitter-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://t.me/elpsycn" title="Telegram Channel" target="_blank" style="color:#0088CC"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-telegram-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="mailto:me@yunyoujun.cn" title="E-Mail" target="_blank" style="color:#8E71C1"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-mail-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://travellings.now.sh/" title="Travelling" target="_blank" style="color:var(--hty-text-color)"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-send-plane-2-line"></use></svg></a></div><hr style="margin:0.5rem 1rem"><div class="links"><a class="links-item hty-icon-button" href="/yun/links/" title="我的小伙伴们" style="color:dodgerblue"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-genderless-line"></use></svg></a></div><br><a class="links-item hty-icon-button" id="toggle-mode-btn" href="javascript:;" title="Mode" style="color: #f1cb64"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-contrast-2-line"></use></svg></a></div><div class="sidebar-panel sidebar-panel-active" id="post-toc-wrap"><div class="post-toc"><div class="post-toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8F%92%E4%BB%B6%E5%AE%89%E8%A3%85"><span class="toc-number">1.</span> <span class="toc-text">插件安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B3%A8%E5%86%8Cwebpushr%E8%B4%A6%E5%8F%B7"><span class="toc-number">2.</span> <span class="toc-text">注册webpushr账号</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%87%A0%E4%B8%AA%E5%BF%85%E8%A6%81%E9%85%8D%E7%BD%AE"><span class="toc-number">3.</span> <span class="toc-text">获取几个必要配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A6%82%E4%BD%95%E5%AE%8C%E6%88%90%E6%96%87%E7%AB%A0%E6%9B%B4%E6%96%B0%E6%8E%A8%E9%80%81"><span class="toc-number">4.</span> <span class="toc-text">如何完成文章更新推送</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B6%E4%BB%96%E9%A1%BB%E7%9F%A5"><span class="toc-number">5.</span> <span class="toc-text">其他须知</span></a></li></ol></div></div></div></aside><main class="sidebar-translate" id="content"><div id="post"><article class="post-block" itemscope itemtype="https://schema.org/Article"><link itemprop="mainEntityOfPage" href="https://ccknbc.github.io/yun/yun/posts/4/"><span hidden itemprop="author" itemscope itemtype="https://schema.org/Person"><meta itemprop="name" content="CC康纳百川"><meta itemprop="description"></span><span hidden itemprop="publisher" itemscope itemtype="https://schema.org/Organization"><meta itemprop="name" content="CC康纳百川"></span><header class="post-header"><h1 class="post-title" itemprop="name headline">简单浏览器更新推送的实现<a class="post-edit-link" href="https://github.com/ccknbc-actions/blog-yun/blob/master/source/_posts/技术/简单浏览器更新推送的实现.md" target="_blank" title="编辑" rel="noopener"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-edit-line"></use></svg></a></h1><div class="post-meta"><div class="post-time" style="display:block"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-calendar-line"></use></svg></span> <span class="post-meta-icon-text">发表于</span> <time title="创建时间：2020-08-18 20:39:36" itemprop="dateCreated datePublished" datetime="2020-08-18T20:39:36+08:00">2020-08-18</time></div><span class="post-count"><span class="post-symbolcount"><span class="post-meta-item-icon" title="本文字数"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-file-word-line"></use></svg></span> <span title="本文字数">1.2k</span><span class="post-meta-divider">-</span><span class="post-meta-item-icon" title="阅读时长"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-timer-line"></use></svg></span> <span title="阅读时长">4m</span></span></span><span class="post-busuanzi"><span class="post-meta-divider">-</span><span class="post-meta-item-icon" title="阅读次数"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg> <span id="busuanzi_value_page_pv"></span></span></span><div class="post-classify"><span class="post-category"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-folder-line"></use></svg></span> <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a class="category" href="/yun/categories/web-push/" style="--text-color:var(--hty-text-color)" itemprop="url" rel="index"><span itemprop="text">web-push</span></a></span> > <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a class="category" href="/yun/categories/web-push/%E6%8E%A8%E9%80%81/" style="--text-color:var(--hty-text-color)" itemprop="url" rel="index"><span itemprop="text">推送</span></a></span></span><span class="post-tag"><span class="post-meta-divider">-</span><a class="tag" href="/yun/tags/webpushr/" style="--text-color:var(--hty-text-color)"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="tag-name">webpushr</span></a><a class="tag" href="/yun/tags/web-push/" style="--text-color:var(--hty-text-color)"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="tag-name">web-push</span></a></span></div><div class="post-author"><div class="author-avatar"><img src="https://www.gravatar.com/avatar/1928aaddbe6e7107395bf3ac99f35886?s=20&amp;d=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2FYunYouJun%2Fcdn%2Fimg%2Favatar%2Fnone.jpg"></div><span class="author-name">CC</span></div></div></header><section class="post-body" itemprop="articleBody"><div class="post-content markdown-body" style="--smc-primary:#0078E7;"><p>这篇文章主要想大家介绍如何使用<code>webpushr</code>及其对应的插件<code>hexo-web-push-notification</code>来帮我们节省时间完成自动推送更新</p>
<a id="more"></a>

<h2 id="插件安装"><a href="#插件安装" class="headerlink" title="插件安装"></a>插件安装</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">npm i hexo-web-push-notification --save</span><br></pre></td></tr></table></figure>
<h2 id="注册webpushr账号"><a href="#注册webpushr账号" class="headerlink" title="注册webpushr账号"></a>注册webpushr账号</h2><p><strong><a target="_blank" rel="noopener" href="https://app.webpushr.com/">首先进入官网注册账号</a></strong> ，注意需要谷歌人机验证，请自备工具访问<br><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:11:29-https/s1.ax1x.com/2020/08/18.png" alt="注册账号" loading="lazy" loading="lazy"></p>
<p>注册后登录就进入网站选择界面，不过新注册应该是直接进入添加新网站，老用户也可点击添加新网站，但实际上可以多网站共用，因此也就没没必要了<br><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:51-https/s1.ax1x.com/2020/08/18.png" alt="登陆成功" loading="lazy" loading="lazy"></p>
<p>根据图中提示自行完善网站信息<br><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:43-https/s1.ax1x.com/2020/08/18.png" alt="添加网站" loading="lazy" loading="lazy"></p>
<p>注册完毕后就可前往管理面板了<br><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:33-https/s1.ax1x.com/2020/08/18.png" alt="验证安装" loading="lazy" loading="lazy"></p>
<p>这里截图划线部分为<code>Tracking code</code>，忘记保存的话可以回退步骤，或者待会儿在管理面板查看<br><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:23-https/s1.ax1x.com/2020/08/18.png" alt="安装组件" loading="lazy" loading="lazy"></p>
<p>然后我们大致熟悉一下环境，更多信息可自行查看；为什么使用这个实际上因为</p>
<ol>
<li>他能做到用户主动订阅浏览器更新通知，新文章或者公告等（后面再讲）</li>
<li>它在60000订阅一下是完全免费的，而且很可靠，你不需要服务器或者其他复杂配置，所有一切均由webpushr完成</li>
<li>懒得使用网站统计，它这个可视化的数据也还是够用了，每周也会给你发一封邮件，说明你这周的订阅表现</li>
<li>它的功能强大，自定义程度高，界面比较友好</li>
</ol>
<p><img src="https://cdn.jsdelivr.net/gh/ccknbc-backup/photos/img/2020.09.11-18:12:00-https/s1.ax1x.com/2020/08/18.png" alt="面板预览" loading="lazy" loading="lazy"></p>
<p>当然他还是有缺点的</p>
<ol>
<li>浏览器清除本地数据后他会把你当作新用户发送欢迎通知，影响了数据统计</li>
<li>它的地图把宝岛台湾划在中国之外</li>
<li>有时候你会延后几天收到一条更新通知</li>
</ol>
<h2 id="获取几个必要配置"><a href="#获取几个必要配置" class="headerlink" title="获取几个必要配置"></a>获取几个必要配置</h2><ol>
<li>点击<code>Setup</code> -&gt; <code>Tracking code</code>(或<code>Integration</code> -&gt; <code>Manual Integration</code>)，如果你刚才保存了可以核对一下是否有误</li>
<li>点击<code>Integration</code> -&gt; <code>REST API Keys</code>可以获取到<code>Key</code>和<code>Authentication Token</code></li>
</ol>
<p>加下来我们进行配置，<a target="_blank" rel="noopener" href="https://github.com/glazec/hexo-web-push-notification">按照开发者的README</a>，我们需要在HEXO根目录的配置文件<code>_config.yml</code>添加如下内容（记得替换为自己的）</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">webPushNotification:</span><br><span class="line">  webpushrKey: &quot;your webpushr rest api key&quot;</span><br><span class="line">  webpushrAuthToken: &quot;your webpushr authorize token&quot;</span><br><span class="line">  trackingCode: &quot;AEGlpbdgvBCWXqXI6PtsUzobY7TLV9gwJU8bzMktrwfrSERg_xnLVbjpCw8x2GmFmi1ZcLTz0ni6OnX5MAwoM88&quot;</span><br></pre></td></tr></table></figure>

<p>关于安装部分就差不多结束了，下面我们回到webpushr网站对我们的网站进行相关配置</p>
<p>这部分就不截图了，大家即使不懂英语也能看明白知道setup, push的意思再配合网站的显示，还有操作变化都能明白（网页翻译真好用），比如选择订阅推送的样式内容（emoji也是特色个人觉得），订阅通知小铃铛，欢迎推送，这些在你刚才打开我网站的时候都已经体验过了（如果没有，检查一下弹窗是否被拦截，清楚浏览器数据后体验一下）</p>
<p>API通知就是利用我们生成好的newpost.json本地与远端进行比较来进行更新文章推送，比较特色的就是定时自动推送，这个我们拿来做临时公告也是非常方便的</p>
<p>其他内容就请读者自定探索吧</p>
<h2 id="如何完成文章更新推送"><a href="#如何完成文章更新推送" class="headerlink" title="如何完成文章更新推送"></a>如何完成文章更新推送</h2><p>但说了这么多，触发推送的条件还没讲呢，而我们一般推送文章，大致使用如下格式即可</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">---</span><br><span class="line">title: Hexo使用Web Push Notification 浏览器通知推送</span><br><span class="line">tags:</span><br><span class="line">  - hexo</span><br><span class="line">  - 服务器推送技术</span><br><span class="line">  - push notifications</span><br><span class="line">categories:</span><br><span class="line">  - 开发</span><br><span class="line">comments: true</span><br><span class="line">abbrlink: 98ae9e55</span><br><span class="line">date: 2020-02-26 10:00:00</span><br><span class="line">---</span><br><span class="line"></span><br><span class="line">Web Push Notification 是怎么工作的？个人博客为什么要使用它？如何使用它？</span><br><span class="line"></span><br><span class="line">&lt;!-- more --&gt;</span><br></pre></td></tr></table></figure>
<p>请注意一定要有预览内容，也就是<code>---</code>和<code>&lt;!-- more --&gt;</code>之间的内容</p>
<p>讲到这里我们就发现，我们可以通过是否写预览内容来自主控制是否向订阅者推送这篇文章更新，而不是所有文章都推送，这种主动方式是我觉得比较人性化的</p>
<p>点击 <strong><a target="_blank" rel="noopener" href="https://www.inevitable.tech/posts/a1b574bb/">查看开发经历</a> | <a target="_blank" rel="noopener" href="https://www.inevitable.tech/posts/98ae9e55/">查看更多相关资讯</a> | <a target="_blank" rel="noopener" href="https://www.inevitable.tech/posts/afd56cf2/">特殊推送解决方案</a> | <a target="_blank" rel="noopener" href="https://www.inevitable.tech/posts/a1b574bb/">泛用推送解决方案</a></strong></p>
<h2 id="其他须知"><a href="#其他须知" class="headerlink" title="其他须知"></a>其他须知</h2><p>你如果阅读了隐私，你会发现它可以收集用户的很多信息，比如IP，国家或地区，设配类型等等，这些你可以选择自行开启或关闭，因为有时候过度收集这些无用隐私也是没必要的；不过作为有垃圾评论或者恶意评论来说，这种记录也是一种帮助</p>
<p>当然要想让读者愿意订阅你的博客，你的确要在内容下下功夫，我相信只要你能持续输出有趣有用的内容，就不愁没有订阅者的，一起加油吧！</p>
<p>这篇文章还有许多不足的地方，<strong>如有错误，欢迎指正</strong></p>
</div><ul class="post-copyright"><li class="post-copyright-author"><strong>本文作者：</strong>CC</li><li class="post-copyright-link"><strong>本文链接：</strong><a href="https://ccknbc.github.io/yun/posts/4/" title="简单浏览器更新推送的实现">https://ccknbc.github.io/yun/posts/4/</a></li><li class="post-copyright-license"><strong>版权声明：</strong>本博客所有文章除特别声明外，均默认采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="noopener" title="CC BY-NC-SA 4.0 "><svg class="icon"><use xlink:href="#icon-creative-commons-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-by-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-nc-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-sa-line"></use></svg></a> 许可协议。</li></ul><script>document.addEventListener('copy', function (event) {
  const clipboardData = event.clipboardData || window.clipboardData;
  if (!clipboardData) { return; }
  const text = window.getSelection().toString();
  if (text) {
    event.preventDefault();
    clipboardData.setData('text/plain', text + '\n\n本文作者：CC\n本文链接：https://ccknbc.github.io/yun/posts/4/\n版权声明：本博客所有文章除特别声明外，均默认采用 CC BY-NC-SA 4.0 许可协议。');
  }
});</script></section></article><div class="post-nav"><div class="post-nav-item"><a class="post-nav-prev" href="/yun/posts/5/" rel="prev" title="Uptime免费网站存活监控"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-left-s-line"></use></svg><span class="post-nav-text">Uptime免费网站存活监控</span></a></div><div class="post-nav-item"><a class="post-nav-next" href="/yun/posts/3/" rel="next" title="HEXO折腾"><span class="post-nav-text">HEXO折腾</span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-right-s-line"></use></svg></a></div></div></div><div id="comment"><div class="comment-tooltip text-center"><span>点击按钮跳转 GitHub Issues 评论</span><br><span>若没有本文 Issue，您可以使用 Comment 模版新建</span><br><a class="hty-button hty-button--raised" id="github-issues" target="_blank" rel="noopener" href="https://github.com/ccknbc-backup/comments/issues?q=is:issue+简单浏览器更新推送的实现">GitHub Issues</a></div><div id="disqus_thread"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/disqusjs@latest/dist/disqusjs.css"><script src="https://cdn.jsdelivr.net/npm/disqusjs@latest/dist/disqus.js"></script><script>const disqusjsConfig = {"enable":true,"shortname":"ccknbc","count":true,"apikey":"Z6F8Gc9KvW2YCh6p11VRVNvMBYfdaKR3IMRFLVmoYaIQJ2ysp38fZ9tivPdgyBWu","siteName":"CC的部落格","identifier":null,"url":null,"title":null,"nesting":4,"nocomment":"这里冷冷清清的，一条评论也没有，快来留下脚印吧！","admin":"ccknbc","adminLabel":"ccknbc"}
function loadDisqus() {
  const dsqjs = new DisqusJS(disqusjsConfig)
}</script><script src="/yun/js/comments/disqus.js"></script><style>.utterances {
  max-width: 100%;
}</style><script src="https://utteranc.es/client.js" repo="ccknbc-backup/comments" issue-term="title" label="💬comment" theme="github-light" crossorigin="anonymous" async></script></div></main><footer class="sidebar-translate" id="footer"><div class="copyright"><span>&copy; 2020 </span><span class="with-love" id="animate"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-cloud-line"></use></svg></span><span class="author"> CC康纳百川</span></div><div class="powered"><span>由 <a href="https://hexo.io" target="_blank" rel="noopener">Hexo</a> 驱动 v5.2.0</span><span class="footer-separator">|</span><span>主题 - <a rel="noopener" href="https://github.com/YunYouJun/hexo-theme-yun" target="_blank"><span>Yun</span></a> v1.2.0</span></div><div class="live_time"><span>本博客已萌萌哒地运行</span><span id="display_live_time"></span><span class="moe-text">(●'◡'●)</span><script>function blog_live_time() {
  window.setTimeout(blog_live_time, 1000);
  const start = new Date('2020-06-04T00:00:00');
  const now = new Date();
  const timeDiff = (now.getTime() - start.getTime());
  const msPerMinute = 60 * 1000;
  const msPerHour = 60 * msPerMinute;
  const msPerDay = 24 * msPerHour;
  const passDay = Math.floor(timeDiff / msPerDay);
  const passHour = Math.floor((timeDiff % msPerDay) / 60 / 60 / 1000);
  const passMinute = Math.floor((timeDiff % msPerHour) / 60 / 1000);
  const passSecond = Math.floor((timeDiff % msPerMinute) / 1000);
  display_live_time.innerHTML = " " + passDay + " 天 " + passHour + " 小时 " + passMinute + " 分 " + passSecond + " 秒";
}
blog_live_time();
</script></div><div id="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_site_uv" title="总访客量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-user-line"></use></svg></span><span id="busuanzi_value_site_uv"></span></span><span class="footer-separator">|</span><span id="busuanzi_container_site_pv" title="总访问量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg></span><span id="busuanzi_value_site_pv"></span></span></div></footer><a class="hty-icon-button" id="goUp" aria-label="back-to-top" href="#"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-up-s-line"></use></svg><svg class="progress-circle-container" viewBox="0 0 100 100"><circle class="progress-circle" id="progressCircle" cx="50" cy="50" r="48" fill="none" stroke="#0078E7" stroke-width="2" stroke-linecap="round"></circle></svg></a><a class="popup-trigger hty-icon-button icon-search" id="search" href="javascript:;" title="搜索"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search-line"></use></svg></span></a><script>window.addEventListener("DOMContentLoaded", () => {
  // Handle and trigger popup window
  document.querySelector(".popup-trigger").addEventListener("click", () => {
    document.querySelector(".popup").classList.add("show");
    setTimeout(() => {
      document.querySelector(".search-input").focus();
    }, 100);
  });

  // Monitor main search box
  const onPopupClose = () => {
    document.querySelector(".popup").classList.remove("show");
  };

  document.querySelector(".popup-btn-close").addEventListener("click", () => {
    onPopupClose();
  });

  window.addEventListener("keyup", event => {
    if (event.key === "Escape") {
      onPopupClose();
    }
  });
});
</script><script src="/yun/js/search/local-search.js" defer></script><div class="popup search-popup"><div class="search-header"><span class="popup-btn-close close-icon hty-icon-button"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-close-line"></use></svg></span></div><div class="search-input-container"><input class="search-input" id="local-search-input" type="text" placeholder="搜索..." value=""></div><div id="local-search-result"></div></div><script>const date = new Date();
const today = (date.getMonth() + 1) + "-" + date.getDate()
const mourn_days = ["4-4","9-18"]
if (mourn_days.includes(today)) {
  document.documentElement.style.filter = "grayscale(1)";
}</script></div><script defer src="/yun/js/utils.js"></script><script defer src="/yun/js/hexo-theme-yun.js"></script></body></html>